#FM33LE0
cmake_minimum_required(VERSION 3.22)

project(FM33LE0)
add_library(FM33LE0 INTERFACE)

# Enable CMake support for ASM and C languages
enable_language(C ASM)

target_compile_definitions(FM33LE0 INTERFACE
    #$<$<CONFIG:Debug>:DEBUG>
)

target_include_directories(FM33LE0 INTERFACE
        ${CMAKE_SOURCE_DIR}/Driver/FM33LE0xx_FL_Driver/Inc
        ${CMAKE_SOURCE_DIR}/Driver/CMSIS/Device/FM33LE0/Include
)

target_sources(FM33LE0 INTERFACE
        ${CMAKE_SOURCE_DIR}/Driver/FM33LE0xx_FL_Driver/Src/fm33le0xx_fl.c
        ${CMAKE_SOURCE_DIR}/Driver/FM33LE0xx_FL_Driver/Src/fm33le0xx_fl_adc.c
        ${CMAKE_SOURCE_DIR}/Driver/FM33LE0xx_FL_Driver/Src/fm33le0xx_fl_aes.c
        ${CMAKE_SOURCE_DIR}/Driver/FM33LE0xx_FL_Driver/Src/fm33le0xx_fl_atim.c
        ${CMAKE_SOURCE_DIR}/Driver/FM33LE0xx_FL_Driver/Src/fm33le0xx_fl_bstim32.c
        ${CMAKE_SOURCE_DIR}/Driver/FM33LE0xx_FL_Driver/Src/fm33le0xx_fl_comp.c
        ${CMAKE_SOURCE_DIR}/Driver/FM33LE0xx_FL_Driver/Src/fm33le0xx_fl_crc.c
        ${CMAKE_SOURCE_DIR}/Driver/FM33LE0xx_FL_Driver/Src/fm33le0xx_fl_divas.c
        ${CMAKE_SOURCE_DIR}/Driver/FM33LE0xx_FL_Driver/Src/fm33le0xx_fl_dma.c
        ${CMAKE_SOURCE_DIR}/Driver/FM33LE0xx_FL_Driver/Src/fm33le0xx_fl_exti.c
        ${CMAKE_SOURCE_DIR}/Driver/FM33LE0xx_FL_Driver/Src/fm33le0xx_fl_flash.c
        ${CMAKE_SOURCE_DIR}/Driver/FM33LE0xx_FL_Driver/Src/fm33le0xx_fl_gpio.c
        ${CMAKE_SOURCE_DIR}/Driver/FM33LE0xx_FL_Driver/Src/fm33le0xx_fl_gptim.c
        ${CMAKE_SOURCE_DIR}/Driver/FM33LE0xx_FL_Driver/Src/fm33le0xx_fl_i2c.c
        ${CMAKE_SOURCE_DIR}/Driver/FM33LE0xx_FL_Driver/Src/fm33le0xx_fl_i2csmb.c
        ${CMAKE_SOURCE_DIR}/Driver/FM33LE0xx_FL_Driver/Src/fm33le0xx_fl_iwdt.c
        ${CMAKE_SOURCE_DIR}/Driver/FM33LE0xx_FL_Driver/Src/fm33le0xx_fl_lcd.c
        ${CMAKE_SOURCE_DIR}/Driver/FM33LE0xx_FL_Driver/Src/fm33le0xx_fl_lptim32.c
        ${CMAKE_SOURCE_DIR}/Driver/FM33LE0xx_FL_Driver/Src/fm33le0xx_fl_lpuart.c
        ${CMAKE_SOURCE_DIR}/Driver/FM33LE0xx_FL_Driver/Src/fm33le0xx_fl_opa.c
        ${CMAKE_SOURCE_DIR}/Driver/FM33LE0xx_FL_Driver/Src/fm33le0xx_fl_pmu.c
        ${CMAKE_SOURCE_DIR}/Driver/FM33LE0xx_FL_Driver/Src/fm33le0xx_fl_rcc.c
        ${CMAKE_SOURCE_DIR}/Driver/FM33LE0xx_FL_Driver/Src/fm33le0xx_fl_rng.c
        ${CMAKE_SOURCE_DIR}/Driver/FM33LE0xx_FL_Driver/Src/fm33le0xx_fl_rtc.c
        ${CMAKE_SOURCE_DIR}/Driver/FM33LE0xx_FL_Driver/Src/fm33le0xx_fl_spi.c
        ${CMAKE_SOURCE_DIR}/Driver/FM33LE0xx_FL_Driver/Src/fm33le0xx_fl_svd.c
        ${CMAKE_SOURCE_DIR}/Driver/FM33LE0xx_FL_Driver/Src/fm33le0xx_fl_u7816.c
        ${CMAKE_SOURCE_DIR}/Driver/FM33LE0xx_FL_Driver/Src/fm33le0xx_fl_uart.c
        ${CMAKE_SOURCE_DIR}/Driver/FM33LE0xx_FL_Driver/Src/fm33le0xx_fl_wwdt.c
        ${CMAKE_SOURCE_DIR}/Driver/CMSIS/Device/FM33LE0/Source/system_fm33le0xx.c
        ${CMAKE_SOURCE_DIR}/Driver/CMSIS/Device/FM33LE0/Source/syscalls.c
        ${CMAKE_SOURCE_DIR}/Driver/CMSIS/Device/FM33LE0/Source/sysmem.c
        ${CMAKE_SOURCE_DIR}/Driver/startup_fm33le0xx.s
)

target_link_directories(FM33LE0 INTERFACE

)

target_link_libraries(FM33LE0 INTERFACE

)

# Validate that STM32CubeMX code is compatible with C standard
if(CMAKE_C_STANDARD LESS 11)
    message(ERROR "code requires C99 or higher")
endif()


